package com.example.flink.controller;

import com.example.flink.service.LogQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

@RestController
@RequestMapping("/api/logs")
public class LogQueryController {
    @Autowired
    private LogQueryService logQueryService;

    @GetMapping
    public Map<String, Object> queryLogs(@RequestParam String query,
                                         @RequestParam(defaultValue = "1") int page,
                                         @RequestParam(defaultValue = "20") int size) {
        return logQueryService.queryLogs(query, page, size);
    }

    @GetMapping("/stats")
    public Map<String, Object> statsLogs(@RequestParam String query) {
        return logQueryService.statsLogs(query);
    }
} 